#ifndef MG_HTR3212_H
#define MG_HTR3212_H

#include "ite/itp.h" //for all ith driver (include GPIO) & MACRO
#include <sys/ioctl.h>
#include <unistd.h>
#include "mg_iic.h"
#include "string.h"

#define HTR3212_RST_Pin		14

#define HTR3212_LED_DEVICE_ADDR		0X3C  //本机写地址

#define HTR3212_BRIGHTNESS_ASTRICT	50	//50%

//寄存器说明
#define HTR3212_SHUTDOWN		0X00	//软件设置关断
#define HTR3212_LEDPWM0			0X0D-3	//亮度控制LED0
#define HTR3212_LEDPWM1			0X0E-3	//亮度控制LED1
#define HTR3212_LEDPWM2			0X0F-3	//亮度控制LED2
#define HTR3212_LEDPWM3			0X10-3	//亮度控制LED3
#define HTR3212_LEDPWM4			0X11-3	//亮度控制LED4
#define HTR3212_LEDPWM5			0X12-3	//亮度控制LED5
#define HTR3212_LEDPWM6			0X13-3	//亮度控制LED6
#define HTR3212_LEDPWM7			0X14-3	//亮度控制LED7
#define HTR3212_LEDPWM8			0X15-3	//亮度控制LED8
#define HTR3212_LEDPWM9			0X16-3	//亮度控制LED9
#define HTR3212_LEDPWM10		0X17-3	//亮度控制LED10
#define HTR3212_LEDPWM11		0X18-3	//亮度控制LED11
#define HTR3212_PWM_UPDATA		0X25	//PWM寄存器更新
#define HTR3212_LED0_SWITCH		0x32-3	//第1路LED开关状态及电流控制
#define HTR3212_LED1_SWITCH		0x33-3	//第2路LED开关状态及电流控制
#define HTR3212_LED2_SWITCH		0x34-3	//第3路LED开关状态及电流控制
#define HTR3212_LED3_SWITCH		0x35-3	//第4路LED开关状态及电流控制
#define HTR3212_LED4_SWITCH		0x36-3	//第5路LED开关状态及电流控制
#define HTR3212_LED5_SWITCH		0x37-3	//第6路LED开关状态及电流控制
#define HTR3212_LED6_SWITCH		0x38-3	//第7路LED开关状态及电流控制
#define HTR3212_LED7_SWITCH		0x39-3	//第8路LED开关状态及电流控制
#define HTR3212_LED8_SWITCH		0x3A-3	//第9路LED开关状态及电流控制
#define HTR3212_LED9_SWITCH		0x3B-3	//第10路LED开关状态及电流控制
#define HTR3212_LED10_SWITCH	0x3C-3	//第11路LED开关状态及电流控制
#define HTR3212_LED11_SWITCH	0x3D-3	//第12路LED开关状态及电流控制
#define HTR3212_ALL_SWITCH		0x4A	//所有LED开关状态控制
#define HTR3212_LED_FREQUENCY	0X4B	//LED通道频率
#define HTR3212_RESET_REG		0X4F	//复位寄存器


//控制单个Led
void HTR3212_Set_SingleLed(uint8_t Led_Num, uint8_t PWM);
//所有SinglePwm设置
void HTR3212SetAllPWMSame(uint8_t duty);
//所有SinglePwm设置(不同值)
void HTR3212SetAllPWM(uint8_t* duty);
//RGB驱动初始化
uint32_t HTR3212_Init(void);
#endif